<?php

/**
 * This is the model class for table "profile".
 *
 * The followings are the available columns in table 'profile':
 * @property string $idprofile
 * @property integer $no_urut
 * @property string $no_ang
 * @property string $nama
 * @property string $gelar
 * @property string $ktp
 * @property string $tempat
 * @property string $lahir
 * @property string $alamat
 * @property string $rt
 * @property string $rw
 * @property string $kelurahan
 * @property string $telp
 * @property string $hp
 * @property string $foto
 * @property string $pendidikan
 * @property string $asal
 * @property string $kelamin
 * @property string $darah
 * @property integer $agama
 * @property string $perkawinan
 * @property integer $pekerjaan
 * @property string $bidangkerja
 * @property string $porganisasi
 * @property string $namaorganisasi
 * @property string $jabatanorganisasi
 * @property string $jenisanggota
 * @property string $toefl
 * @property string $sks
 * @property string $prestasi
 * @property string $beasiswa
 * @property string $besarbea
 * @property string $mulaibea
 * @property string $akhirbea
 * @property string $jdlskripsi
 * @property string $pembimbing1
 * @property string $pembimbing2
 * @property string $statuspemb1
 * @property string $statuspemb2
 * @property string $tglsetuju
 * @property string $tglujian
 * @property string $kel
 * @property string $kota
 * @property string $ipk
 * @property string $mulaingajar
 * @property integer $insmengajar
 * @property string $mulaiclas
 * @property integer $gajiclas
 * @property string $tmplesclassical
 * @property string $mulaiprivate
 * @property integer $gajiprivate
 * @property string $templesprivate
 * @property string $kerjalain
 * @property string $mulaikerjalain
 * @property integer $gajikerjalain
 * @property string $tmpkerjalain
 * @property string $pekerjaanlain
 * @property string $alamatkerjalain
 *
 * The followings are the available model relations:
 * @property User[] $users
 */
class Register extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'profile';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('idprofile, nama', 'required'),
			array('no_urut, agama, pekerjaan, insmengajar, gajiclas, gajiprivate, gajikerjalain', 'numerical', 'integerOnly'=>true),
			array('idprofile', 'length', 'max'=>50),
			array('no_ang', 'length', 'max'=>25),
			array('nama, alamat, bidangkerja', 'length', 'max'=>255),
			array('gelar', 'length', 'max'=>4),
			array('ktp, tempat, kelurahan, telp, pendidikan, asal, namaorganisasi, jabatanorganisasi, prestasi, beasiswa, kel, kota, tmplesclassical, templesprivate, kerjalain, tmpkerjalain, pekerjaanlain, alamatkerjalain', 'length', 'max'=>45),
			array('rt, rw, ipk', 'length', 'max'=>5),
			array('hp, porganisasi', 'length', 'max'=>20),
			array('kelamin, perkawinan, statuspemb1, statuspemb2', 'length', 'max'=>1),
			array('darah', 'length', 'max'=>2),
			array('jenisanggota, toefl, sks', 'length', 'max'=>3),
			array('besarbea', 'length', 'max'=>15),
			array('pembimbing1, pembimbing2', 'length', 'max'=>100),
			array('lahir, foto, mulaibea, akhirbea, jdlskripsi, tglsetuju, tglujian, mulaingajar, mulaiclas, mulaiprivate, mulaikerjalain', 'safe'),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('idprofile, no_urut, no_ang, nama, gelar, ktp, tempat, lahir, alamat, rt, rw, kelurahan, telp, hp, foto, pendidikan, asal, kelamin, darah, agama, perkawinan, pekerjaan, bidangkerja, porganisasi, namaorganisasi, jabatanorganisasi, jenisanggota, toefl, sks, prestasi, beasiswa, besarbea, mulaibea, akhirbea, jdlskripsi, pembimbing1, pembimbing2, statuspemb1, statuspemb2, tglsetuju, tglujian, kel, kota, ipk, mulaingajar, insmengajar, mulaiclas, gajiclas, tmplesclassical, mulaiprivate, gajiprivate, templesprivate, kerjalain, mulaikerjalain, gajikerjalain, tmpkerjalain, pekerjaanlain, alamatkerjalain', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'users' => array(self::HAS_MANY, 'User', 'profile_idprofile'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'idprofile' => 'Idprofile',
			'no_urut' => 'No Urut',
			'no_ang' => 'No Ang',
			'nama' => 'Nama',
			'gelar' => 'Gelar',
			'ktp' => 'Ktp',
			'tempat' => 'Tempat',
			'lahir' => 'Lahir',
			'alamat' => 'Alamat',
			'rt' => 'Rt',
			'rw' => 'Rw',
			'kelurahan' => 'Kelurahan',
			'telp' => 'Telp',
			'hp' => 'Hp',
			'foto' => 'Foto',
			'pendidikan' => 'Pendidikan',
			'asal' => 'Asal',
			'kelamin' => 'Kelamin',
			'darah' => 'Darah',
			'agama' => 'Agama',
			'perkawinan' => 'Perkawinan',
			'pekerjaan' => 'Pekerjaan',
			'bidangkerja' => 'Bidangkerja',
			'porganisasi' => 'Porganisasi',
			'namaorganisasi' => 'Namaorganisasi',
			'jabatanorganisasi' => 'Jabatanorganisasi',
			'jenisanggota' => 'Jenisanggota',
			'toefl' => 'Toefl',
			'sks' => 'Sks',
			'prestasi' => 'Prestasi',
			'beasiswa' => 'Beasiswa',
			'besarbea' => 'Besarbea',
			'mulaibea' => 'Mulaibea',
			'akhirbea' => 'Akhirbea',
			'jdlskripsi' => 'Jdlskripsi',
			'pembimbing1' => 'Pembimbing1',
			'pembimbing2' => 'Pembimbing2',
			'statuspemb1' => 'Statuspemb1',
			'statuspemb2' => 'Statuspemb2',
			'tglsetuju' => 'Tglsetuju',
			'tglujian' => 'Tglujian',
			'kel' => 'Kel',
			'kota' => 'Kota',
			'ipk' => 'Ipk',
			'mulaingajar' => 'Mulaingajar',
			'insmengajar' => 'Insmengajar',
			'mulaiclas' => 'Mulaiclas',
			'gajiclas' => 'Gajiclas',
			'tmplesclassical' => 'Tmplesclassical',
			'mulaiprivate' => 'Mulaiprivate',
			'gajiprivate' => 'Gajiprivate',
			'templesprivate' => 'Templesprivate',
			'kerjalain' => 'Kerjalain',
			'mulaikerjalain' => 'Mulaikerjalain',
			'gajikerjalain' => 'Gajikerjalain',
			'tmpkerjalain' => 'Tmpkerjalain',
			'pekerjaanlain' => 'Pekerjaanlain',
			'alamatkerjalain' => 'Alamatkerjalain',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('idprofile',$this->idprofile,true);
		$criteria->compare('no_urut',$this->no_urut);
		$criteria->compare('no_ang',$this->no_ang,true);
		$criteria->compare('nama',$this->nama,true);
		$criteria->compare('gelar',$this->gelar,true);
		$criteria->compare('ktp',$this->ktp,true);
		$criteria->compare('tempat',$this->tempat,true);
		$criteria->compare('lahir',$this->lahir,true);
		$criteria->compare('alamat',$this->alamat,true);
		$criteria->compare('rt',$this->rt,true);
		$criteria->compare('rw',$this->rw,true);
		$criteria->compare('kelurahan',$this->kelurahan,true);
		$criteria->compare('telp',$this->telp,true);
		$criteria->compare('hp',$this->hp,true);
		$criteria->compare('foto',$this->foto,true);
		$criteria->compare('pendidikan',$this->pendidikan,true);
		$criteria->compare('asal',$this->asal,true);
		$criteria->compare('kelamin',$this->kelamin,true);
		$criteria->compare('darah',$this->darah,true);
		$criteria->compare('agama',$this->agama);
		$criteria->compare('perkawinan',$this->perkawinan,true);
		$criteria->compare('pekerjaan',$this->pekerjaan);
		$criteria->compare('bidangkerja',$this->bidangkerja,true);
		$criteria->compare('porganisasi',$this->porganisasi,true);
		$criteria->compare('namaorganisasi',$this->namaorganisasi,true);
		$criteria->compare('jabatanorganisasi',$this->jabatanorganisasi,true);
		$criteria->compare('jenisanggota',$this->jenisanggota,true);
		$criteria->compare('toefl',$this->toefl,true);
		$criteria->compare('sks',$this->sks,true);
		$criteria->compare('prestasi',$this->prestasi,true);
		$criteria->compare('beasiswa',$this->beasiswa,true);
		$criteria->compare('besarbea',$this->besarbea,true);
		$criteria->compare('mulaibea',$this->mulaibea,true);
		$criteria->compare('akhirbea',$this->akhirbea,true);
		$criteria->compare('jdlskripsi',$this->jdlskripsi,true);
		$criteria->compare('pembimbing1',$this->pembimbing1,true);
		$criteria->compare('pembimbing2',$this->pembimbing2,true);
		$criteria->compare('statuspemb1',$this->statuspemb1,true);
		$criteria->compare('statuspemb2',$this->statuspemb2,true);
		$criteria->compare('tglsetuju',$this->tglsetuju,true);
		$criteria->compare('tglujian',$this->tglujian,true);
		$criteria->compare('kel',$this->kel,true);
		$criteria->compare('kota',$this->kota,true);
		$criteria->compare('ipk',$this->ipk,true);
		$criteria->compare('mulaingajar',$this->mulaingajar,true);
		$criteria->compare('insmengajar',$this->insmengajar);
		$criteria->compare('mulaiclas',$this->mulaiclas,true);
		$criteria->compare('gajiclas',$this->gajiclas);
		$criteria->compare('tmplesclassical',$this->tmplesclassical,true);
		$criteria->compare('mulaiprivate',$this->mulaiprivate,true);
		$criteria->compare('gajiprivate',$this->gajiprivate);
		$criteria->compare('templesprivate',$this->templesprivate,true);
		$criteria->compare('kerjalain',$this->kerjalain,true);
		$criteria->compare('mulaikerjalain',$this->mulaikerjalain,true);
		$criteria->compare('gajikerjalain',$this->gajikerjalain);
		$criteria->compare('tmpkerjalain',$this->tmpkerjalain,true);
		$criteria->compare('pekerjaanlain',$this->pekerjaanlain,true);
		$criteria->compare('alamatkerjalain',$this->alamatkerjalain,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return Register the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
